package micro

import (
	"cdzhmc.com/go-mc/micro/broker"
	"cdzhmc.com/go-mc/micro/client"
	"cdzhmc.com/go-mc/micro/config/cmd"
	"cdzhmc.com/go-mc/micro/registry"
	"cdzhmc.com/go-mc/micro/server"
	"cdzhmc.com/go-mc/micro/transport"
	"context"
)

type Options struct {
	//Auth      auth.Auth
	Broker    broker.Broker
	Client    client.Client
	Server    server.Server
	Registry  registry.Registry
	Transport transport.Transport
	Cmd       cmd.Cmd

	// Before and After funcs
	BeforeStart []func() error
	BeforeStop  []func() error
	AfterStart  []func() error
	AfterStop   []func() error

	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context

	Signal bool
}

func newOptions(opts ...Option) Options {
	opt := Options{
		Broker:    nil,
		Client:    nil,
		Server:    nil,
		Registry:  nil,
		Transport: nil,
		Context:   context.Background(),
		Signal:    true,
	}
	for _, o := range opts {
		o(&opt)
	}
	return opt
}

